import QtQuick 2.14
import QtQuick.Controls 2.14

Button {
    id: customButton
    
    property color primaryColor: "#2196F3"
    property color hoverColor: "#1976D2"
    property color pressedColor: "#0D47A1"
    property color disabledColor: "#BDBDBD"
    
    implicitWidth: Math.max(120, contentItem.implicitWidth + leftPadding + rightPadding)
    implicitHeight: Math.max(36, contentItem.implicitHeight + topPadding + bottomPadding)
    
    leftPadding: 16
    rightPadding: 16
    topPadding: 8
    bottomPadding: 8
    
    background: Rectangle {
        radius: 4
        color: {
            if (!customButton.enabled) return disabledColor
            if (customButton.pressed) return pressedColor
            if (customButton.hovered) return hoverColor
            return primaryColor
        }
        
        Behavior on color {
            ColorAnimation {
                duration: 150
            }
        }
    }
    
    contentItem: Text {
        text: customButton.text
        font: customButton.font
        color: customButton.enabled ? "white" : "#757575"
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        elide: Text.ElideRight
    }
}